<ui:composition xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.org/ui"
        template="template.xhtml">
    <ui:define name="content">
        <div class="content ui-widget ui-widget-content ui-corner-all">
            <h2>Projects</h2>
            <h:form>
                <p:dataTable value="#{projectBean.projects}" var="project" rendered="#{not empty projectBean.projects}" style="width: 100%">
                    <p:column style="width: 50px">
                        <f:facet name="header">Code</f:facet>
                        <h:commandLink value="#{project.code}" action="#{projectBean.edit}" ajax="false">
                            <f:setPropertyActionListener target="#{projectBean.project}" value="${project}" />
                        </h:commandLink>
                    </p:column>
                    <p:column style="width: 200px">
                        <f:facet name="header">Name</f:facet>
                        <h:outputText value="#{project.name}" />
                    </p:column>
                    <p:column>
                        <f:facet name="header">Description</f:facet>
                        <h:outputText value="#{project.description}" />
                    </p:column>
                </p:dataTable>
                <h:panelGroup rendered="#{empty projectBean.projects}">
                    <p>No projects defined.</p>
                </h:panelGroup>
                <br />
                <p:commandButton value="Add Project" action="#{projectBean.add}" ajax="false" />
            </h:form>
        </div>
    </ui:define>
</ui:composition>
